<?php

namespace Wilead\AdminBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller {

    public function indexAction() {
        $filter = $this->get('form.factory')->create(new \Wilead\AdminBundle\Filter\MessageLogFilterType);
        if ($this->get('request')->query->has('submit-filter')) {
            $filter->bind($this->get('request'));
            $filterBuilder = $this->get('doctrine.orm.entity_manager')->getRepository('ProjectSuperBundle:MyEntity')->createQueryBuilder('q');
            $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($filter, $filterBuilder);
            var_dump($filterBuilder->getDql());
        }
        return $this->render('WileadAdminBundle:Default:index.html.twig', array(
                    'filter' => $filter->createView(),
        ));
    }

}
